QTMTB 12 - Specifying Where a Movie is Pasted Using an Offset, GetTrackMatrix, SetTrackMatrix
Technical Q&A's
QTMTB 12 - Specifying Where a Movie is Pasted Using an Offset, GetTrackMatrix, SetTrackMatrix (1-May-95)
Q When a user pastes a movie into a movie-controller movie, the added movie is
inserted in the top left corner of the movie. Is there a way for the user to
choose where the movie is pasted, and if not, how can I give the movie
controller or Movie Toolbox an offset to use rather than have the editing
operations use the top left corner?
A When you paste a movie into a movie-controller movie, the movie controller is
simply calling PasteMovieSelection to insert the source movie. All the
characteristics of the movie are inserted, and therefore the movie is inserted
in the top left corner of the movie. There's no easy way to specify an offset
directly to the movie controller. If you want to change the offset of the
pasted movie, you'll have to modify the movie yourself after the paste using
Movie Toolbox commands. Once you're done changing the movie, be sure to call
MCMovieChanged so that the movie controller updates correctly.
The actual modification is simple: call GetTrackMatrix, add your offset to the
matrix, and call SetTrackMatrix. The difficulty is in determining which tracks
to modify, since the paste may either create a new track or use an existing
one. We recommend doing this by gathering all track IDs before the paste, and
then comparing with the track IDs after the paste. Since most movies these days
have just a few tracks, this shouldn't require much overhead. (But be warned:
some movies do have a lot of tracks!) To get the track information, you can
call GetMovieTrackCount and GetMovieIndTrack.
One last idea: If you don't mind changing the source movie, an alternative is
to simply offset the source movie before the paste.